package org.example.everyday;

public class Lc553 {

    public String optimalDivision(int[] nums) {
        int n = nums.length;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            sb.append(nums[i]);
            if(i + 1 < n){
                sb.append("/");
            }
        }
        if(n > 2){
            sb.insert(sb.indexOf("/")+1,"(");
            sb.append(")");
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        Lc553 lc553 = new Lc553();
        int[] nums = {1000,100,10,2};
        String result = lc553.optimalDivision(nums);
        System.out.println(result);
    }
}
